/*SALES PAGE VENDITA*/
jQuery(document).ready(function($) {

	/* switch testo ancora */
    $(".row.vidTxt .panel p.more a").click( function() {
        var _this = $(this);
        if (  ($(_this).parent().prev().height() ) > 250   ) {
	        $('html, body').animate({
	           scrollTop: $(_this).parent().parent().parent().parent().offset().top - 120
	        }, 1000); 
        }
	});

	/*adatta altezza article in base al testo*/
	$(".row.vidTxt .panel p.more a").click( function() {
	    $(this).parent().prev().toggleClass("viewMore");
	    $(this).text(function(i, text){
			return text === "Per saperne di più" ? "Chiudi" : "Per saperne di più";
		});
	    return false;
	});


	/*Settings scrolling menu secondo livello*/
	$(window).scroll( function() {

	    var a = 70;
	    var pos = $(window).scrollTop();
	    var parentWdt = $(".row.center #tabs_to_content").parent().width();

	    $(".row.center #tabs_to_content").css({
	      "width" : parentWdt,
	      "z-index": 9999,
	      "position" : "fixed",
	      "top" : "50px"
	    });

	    if(pos < a) {
	        $(".row.center #tabs_to_content").css({
	             "position": 'relative',
	             "width": "100%",
	             "top" : 0,
	             "margin-top" : 25,
	        });
	        window.scrollTo(0, 0);
	        
	    }

	});

	
})